package com.szh.zx.gaoDingJavaBook.yitu.two;


public class TestMain {
	public static void main(String[] args) {
		Student2 student2 = new Student2("dddd");
		student2.start();
	}
}
class Teacher{
	private static final Teacher only = new Teacher();

	private Teacher() {
	}
	public static Teacher getOnly(){
		return only ;
	}
	public void hdwt(){
		// 这个daxc 就代表 谁调用hdwt 就指向谁
		Thread daxc = Thread.currentThread();
		String name = daxc.getName();
		System.out.println("老师回答"+name+"的问题");
	}
}
class Student2 extends Thread {
	public Student2(String name) {
		setName(name);
	}
	@Override
	public void run(){
		System.out.println("我叫"+getName()+"");
		Teacher teacher = Teacher.getOnly();
		teacher.hdwt();
	}
}
